package business;

import repository.ClassroomRepository;
import classes.Classroom;
import classes.Iterator;
import exceptions.RepositoryException;

public class ClassroomBusiness
{
	private ClassroomRepository repository;
	
	public ClassroomBusiness() throws RepositoryException
	{
		this.repository = ClassroomRepository.getInstance();
	}
	
	public void add( Classroom classroom) throws RepositoryException
	{
		if( classroom != null )
		{
			repository.add( classroom );
		}
		else
		{
			throw new NullPointerException();
		}

	}
	
	public void edit( Classroom classroom ) throws RepositoryException
	{
		if( classroom != null )
		{
			repository.edit( classroom );
		}
		else
		{
			throw new NullPointerException();
		}
	}
	
	public Iterator< Classroom > find( Classroom classroom ) throws RepositoryException
	{
		Iterator< Classroom > ret;
		
		if( classroom != null )
		{
			ret = repository.find( classroom ); 
		}
		else
		{
			throw new NullPointerException();
		}
		
		return ret;
	}
	
	public Classroom get( int id ) throws RepositoryException
	{
		return repository.get( id );
	}
	
	public Iterator< Classroom > getIterator() throws RepositoryException
	{
		return repository.getIterator();
	}
	
	public void remove( int id ) throws RepositoryException
	{
		repository.remove( id );
	}
	
	public int size() throws RepositoryException
	{
		return repository.size();
	}
}
